var mysql = require('mysql');
var pool = mysql.createPool({
	connectionLimit: 10,
	host: '127.0.0.1',
	user: 'root',
	password: '0',
	database: 'house'
});


const sqlquery = async function(sql) {
	return new Promise((res, rej) => {
		pool.query(sql, function(error, results, fields) {
			if (error) {
				console.log(error)
			} else {
				res(results)
			}
		});
	})
}

module.exports = {
	sqlquery
}
